home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / CDTV / cdtvtools-11 / keeper / blackcfg.asm next >
Encoding:
Assembly Source File  |  1991-06-24  |  3.1 KB  |  151 lines

  1. *****************************************************************************
  2. *
  3. *    Blackcfg -- written by Ray Lambert for Theta Systems, Inc.
  4. *
  5. *    Copyright 1991 Commodore Business Machines, Inc.
  6. *
  7. *****************************************************************************
  8.  
  9.  
  10.         INCLUDE        "keeper.i"
  11.         INCLUDE        "exec/ports.i"
  12.         INCLUDE        "libraries/dos.i"
  13.         INCLUDE        "libraries/dosextens.i"
  14.         INCLUDE        "libraries/dos_equ.i"
  15.  
  16.  
  17.         CSEG
  18.  
  19.  
  20. startup
  21. * save command tail info in safe registers
  22.         move.l        d0,d3
  23.         move.l        a0,a3
  24. * check if we've been run from Workbench or CLI
  25.         move.l        #0,a1
  26.         jsrsys        FindTask        ; get task ptr
  27.         move.l        d0,a1
  28.         tst.l          pr_CLI(a1)
  29.         bne         cli_startup
  30.  
  31. * wb_startup -- humor Workbench a little then quit
  32.         lea        pr_MsgPort(a1),a2       ; our process port
  33.         move.l        a2,a0
  34.         jsrlib        WaitPort
  35.         move.l        a2,a0
  36.         jsrlib        GetMsg
  37.         move.l        d0,d2
  38.         jsrlib        Forbid
  39.         move.l        d2,a1
  40.         jsrlib        ReplyMsg
  41.         rts
  42.  
  43. cli_startup    lea        dosname,a1    ; open dos.library
  44.         moveq.l        #0,d0
  45.         jsrlib        OpenLibrary
  46.         move.l        d0,_DOSBase
  47.         bne        1$
  48.         move.l        #RETURN_FAIL,d0
  49.         bra        abort
  50. * get console output handle
  51. 1$        jsrdos        Output
  52.         move.l        d0,stdout
  53.  
  54. * process command line
  55.                move.b        #0,-1(a3,d3.w)    ; 0-delimit the command line
  56. 2$        move.b        (a3),d0        ; skip leading spaces
  57.         cmp.b        #$20,d0
  58.         beq        3$
  59.         cmp.b        #$09,d0        ; and tabs!
  60.         bne        4$
  61. 3$        inc.l        a3
  62.         bra        2$
  63.  
  64. * attempt to open the file
  65. 4$        tst.b        (a3)        ; no filename?
  66.         bne        5$
  67.         lea        usagemsg,a0
  68.         bra        abortmsg
  69. 5$        move.l        a3,d1
  70.         move.l        #MODE_OLDFILE,d2
  71.         jsrlib        Open
  72.         move.l        d0,file
  73.         bne        6$
  74.         lea        badfilemsg,a0
  75.         bra        abortmsg
  76. * patch mouse pointer colors offsets $66, $68, $6a
  77. 6$        move.l        file,d1
  78.         move.l        #$66,d2
  79.         move.l        #OFFSET_BEGINNING,d3
  80.         jsrlib        Seek
  81.         move.l        file,d1
  82.         lea        zeros,a0
  83.         move.l        a0,d2
  84.         move.l        #6,d3
  85.         jsrlib        Write
  86. * patch screen colors offsets $6e, $70, $72, $74
  87.         move.l        file,d1
  88.         move.l        #$6e,d2
  89.         move.l        #OFFSET_BEGINNING,d3
  90.         jsrlib        Seek
  91.         move.l        file,d1
  92.         lea        zeros,a0
  93.         move.l        a0,d2
  94.         move.l        #8,d3
  95.         jsrlib        Write
  96. * all done!
  97.         lea        okaymsg,a0
  98. abortmsg    bsr        putmsg
  99. abort        move.l        _DOSBase,a6
  100.         cmp.l        #0,a6
  101.         beq        98$
  102.         move.l        file,d1
  103.         beq        99$
  104.         jsrlib        Close
  105. 99$        move.l        a6,a1
  106.         jsrsys        CloseLibrary
  107. 98$        moveq        #0,d0
  108.         rts
  109.  
  110.  
  111.  
  112. putmsg
  113.         pushm.l        d2/d3/a6
  114.         move.l        a0,a1
  115. 1$        tst.b        (a1)+
  116.         bne        1$
  117.         dec.l        a1
  118.         sub.l        a0,a1
  119.         move.l        a1,d3        ; string length
  120.         move.l        a0,d2        ; string pointer
  121.         move.l        stdout,d1    ; console file handle
  122.         beq        ng
  123.         move.l        _DOSBase,a6
  124.         cmp.l        #0,a6
  125.         beq        ng
  126.         jsrlib        Write
  127. ng        pullm.l        d2/d3/a6
  128.         rts
  129.  
  130.  
  131.  
  132.         DSEG
  133.  
  134. _DOSBase    dc.l        0
  135. stdout        dc.l        0
  136. file        dc.l        0
  137. zeros        dc.w        0,0,0,0
  138. dosname        dc.b        'dos.library',0
  139. usagemsg    dc.b        10,'Blackcfg -- A tool to make all colors stored in a',10
  140.         dc.b        'Preferences file (system-configuration) black for',10
  141.         dc.b        'booting with a black screen.',10,10
  142.         dc.b        'Written by Ray Lambert for Theta Systems, Inc.',10
  143.         dc.b        'Copyright 1991 Commodore Business Machines, Inc.',10,10
  144.         dc.b        'Usage: blackcfg <system-configuration-file>',10
  145.         dc.b        'TAKE HEED!! This file will be irreversibly modified!',10,10,0
  146. badfilemsg    dc.b        'Sorry, unable to open that file.',10,0
  147. okaymsg        dc.b        'Done!',10,0
  148.  
  149.  
  150.         END
  151.